package com.vcc.web.controller;

import cn.dev33.satoken.annotation.SaCheckLogin;
import com.vcc.core.annotations.RestPack;
import com.vcc.service.service.AdminParamService;
import com.vcc.service.service.ClientParamService;
import com.vcc.web.core.util.UserUtil;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("clientParams")
public class ClientParamsController {

    @Resource
    private ClientParamService clientParamService;

    @Resource
    private AdminParamService adminParamService;

    @RestPack
    @SaCheckLogin
    @GetMapping("getByCode")
    public String getByCode(String code) {
        return clientParamService.getValueByCodeAndUserIdOrDefaultValue(code, UserUtil.getId(), null);
    }


    @RestPack
    @SaCheckLogin
    @GetMapping("getBySpecialCode")
    public String getBySpecialCode(String code) {
        return adminParamService.getByCode(code).getValue();
    }

}
